<%--
  Created by IntelliJ IDEA.
  User: SXLWTT
  Date: 2021/11/1
  Time: 10:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="/js/jquery-1.9.1.min.js"></script>
    <script src="/js/fileupload.js"></script>
    <link rel="stylesheet" href="/css/css.css">
</head>
<body>
<form>
    姓名:<input type="text" name="aname"><<br>
    性别:<input type="text" name="sex"><<br>
    省市:<input type="text" name="sheng"><<br>
    申请注册单位:<input type="text" name="apply"><<br>
    会计:<select name="tid"></select><<br>
    执业资格证书编号:<input type="text" name="practice"><<br>
    注册号:<input type="text" name="number"><<br>
    有效期:<input type="date" name="adate"><<br>
    <input type="button" value="添加" onclick="add()">
</form>
</body>
</html>
<script>
    $.ajax({
        url:"listType.do",
        type:"post",
        dataType:"json",
        success:function (obj) {
            for (var i in obj ){
                $("[name='tid']").append("<option value='"+obj[i].tid+"'>"+obj[i].tname+"</option>")
            }
        }
    })
    function add() {
        $.ajax({
            url:"add.do",
            data:$("form").serialize(),
            type:"post",
            dataType:"json",
            success:function (obj) {
                if (obj>0){
                    alert("添加成功")
                    location="list.do"
                }
            }
        })
    }
</script>
